package com.study.a06mySet;

import java.util.Iterator;
import java.util.TreeSet;

public class A04_TreeSetDemo2 {
    public static void main(String[] args) {


        //方法一：默认排序/自然排序，Student类需要实现Comparable接口

        Student s1 = new Student("zhangsan", 18);
        Student s2 = new Student("lisi", 39);
        Student s3 = new Student("wangwu", 28);
        Student s4 = new Student("zhangsan", 18);

        TreeSet<Student> ts = new TreeSet<>();

        ts.add(s1);
        ts.add(s2);
        ts.add(s3);
        ts.add(s4);
        System.out.println(ts);



    }
}
